/*
 * BinaryEdge.java
 *
 * Created on June 27, 2006, 1:12 PM
 *
 */

package galronnlp.pcfg.parser;

import galronnlp.util.Symbol;
import galronnlp.util.Tuple;

/**
 * Implementation of an edge for binary productions. This is a 3-tuple, where of
 * the following format:
 * <p>
 * (<code>int</code> split, <code>Symbol</code> left_RHS_Symbol, <code>Symbol</code> right_RHS_Symbol)
 * <p>
 * This is based on the edges as defined in Chris Brew's python
 * Statistical CKY parser
 * @author Daniel A. Galron
 */
public class BinaryEdge extends Edge { 
    
    private Tuple entry = new Tuple(3);
    
    /**
     * Creates a new instance of BinaryEdge
     */
    public BinaryEdge(int m, Symbol B, Symbol C) {
        entry.put(0, new Integer(m));
        entry.put(1, B);
        entry.put(2, C);
    }
    
    public int type() {
        return BINARY;
    }
    
    public Tuple entry() {
        return entry;
    }
    
    public String toString() {
        return "(" + (Integer)entry.get(0) + ", " + (Symbol)entry.get(1) + ", " + (Symbol)entry.get(2) + ")";
    }
}
